package com.design.decorator.text;

public class DecoratorDemo {
    public static void main(String[] args) {
        // 创建基本的文本编辑器
        TextEditor basicEditor = new BasicTextEditor();
        basicEditor.open("example.txt");
        basicEditor.edit();
        basicEditor.save();

        // 创建带有加密和格式化功能的文本编辑器
        TextEditor encryptedAndFormattedEditor = new FormattingDecorator(new EncryptionDecorator(new BasicTextEditor()));
        encryptedAndFormattedEditor.open("secret.txt");
        encryptedAndFormattedEditor.edit();
        encryptedAndFormattedEditor.save();
    }
}
